import Mock from "mockjs";
import axios from "axios";

// Mock.mock( rurl?, rtype?, template|function( options ) )

// 配置 Mock.js 的模拟接口
// Mock.mock("a.json", 'get', function({ url ,type,body}) {
//     console.log(url,type,body, 'URL');
//     return {
//         message: '这是模拟数据',
//         success: true
//     };
// });
var Random = Mock.Random;
Mock.mock("a.json", "get", {
  "list|10-20": [
    {
      "id|+1": 1,
      name: "张可顺",
    },
  ],
  "listName|10": [
    { "id|+1": 1, uname: () => Random.cname(), ename: () => Random.name() },
  ],
});

// 发起 Axios 请求
axios.get("a.json").then((res) => {
  console.log(res.data);
});

axios.get("http://localhost:7411/api/user").then((res) => {
  console.log(res);
});
